#include <cstdio>
const int maxn = 500000;
int color[maxn] = {0};
int main()
{
    int M, N;
    scanf("%d%d", &M, &N);
    int total = M * N;
    int i, j;
    for (i = 0; i < total; ++i)
    {
        scanf("%d", color + i);
    }
    int count;
    int cnt = total / 2;
    for (i = 0; i < total; ++i)
    {
        count = 1;
        for (j = i + 1; j < total; ++j)
        {
            if (color[i] == color[j])
            {
                ++count;
            }
        }
        if (count > cnt)
        {
            printf("%d\n", color[i]);
            break;
        }
    }
    return 0;
}